package com.tqw.shipping.feign;

import com.tqw.pojo.Area;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import com.tqw.entity.Result;
import com.tqw.vo.ShippingVO;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Alex
 */
@FeignClient(name = "tqw-shipping",contextId = "areaServer")
public interface AreaFeignClient {
    /**
     * 联查地区信息
     * @return
     */
    @GetMapping("/shipping/allArea")
    Result<List<Area>> getAllArea();

    /**
     * 查询收货地址列表
     * @param token
     * @return
     */
    @GetMapping("/shipping/list")
    Result<List<ShippingDTO>> list(@RequestHeader("Authorization") String token);

    /**
     * 单个地址回显
     * @param addressId
     * @return
     */
    @GetMapping("/shipping/oneAddr")
    Result<ShippingVO> getAddrId(@RequestHeader("Authorization") String token,@RequestParam("addressId") Integer addressId);

    /**
     * 表单提交更新地区
     * @param shippingVO
     * @return
     */
    @PutMapping("/shipping/update")
    Result update(@RequestHeader("Authorization") String token,@RequestBody ShippingVO shippingVO);

    /**
     * 删除收货地址信息
     * RestFul风格传参
     * @param addressId
     * @return
     */
    @DeleteMapping("/shipping/delete/{addressId}")
    Result delete(@RequestHeader("Authorization") String token,@PathVariable Integer addressId);

    /**
     * 新增收货地址信息
     * @param shippingVO
     * @return
     */
    @PostMapping("/shipping/save")
    Result save(@RequestHeader("Authorization") String token,@RequestBody ShippingVO shippingVO);

}
